package com.tfswx.jcyw;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author ricky
 * @date 2021/10/1
 */
public class TestClass {
    private static final List<String> p1 = Arrays.asList("6", "0", "8", "7");
    private static final List<String> p2 = Arrays.asList("5", "1", "7", "3");
    private static final List<String> p3 = Arrays.asList("1", "3", "5", "8");
    private static final List<String> p4 = Arrays.asList("3", "8", "2", "5");
    private static final List<String> p5 = Arrays.asList("2", "5", "3", "1");

    public static void main(String[] args) {
        Set<String> all = new HashSet<>();
        all.addAll(p1);
        all.addAll(p2);
        all.addAll(p3);
        all.addAll(p4);
        all.addAll(p5);
        List<String> pOne = prosible(all, 0);
        List<String> pTwo = prosible(all, 1);
        List<String> pThree = prosible(all, 2);
        List<String> pFour = prosible(all, 3);

        System.out.println(pOne);
        System.out.println(pTwo);
        System.out.println(pThree);
        System.out.println(pFour);

    }

    private static List<String> prosible(Set<String> all, int i) {
        return all.stream().filter(item -> !p1.get(i).equals(item) && !p2.get(i).equals(item) && !p3.get(i).equals(item) && !p4.get(i).equals(item) && !p5.get(i).equals(item)).collect(Collectors.toList());
    }
}
